<?php

namespace App\Http\Controllers\Admin\Other;

use App\Services\Admin\Other\ExpressService;
use Exception;
use Illuminate\Http\JsonResponse;

class ExpressController extends BaseOtherController
{
    protected ExpressService $expressService;

    /**
     * @throws Exception
     */
    public function __construct()
    {
        parent::__construct();
        $this->expressService = $this->loadService('Admin\Other\ExpressService');
    }

    /**
     * 查询物流信息
     * @return JsonResponse
     * @throws Exception
     */
    public function info(): JsonResponse
    {
        $rule = [
            'type' => 'required|integer|in:10,20',
        ];

        if ($this->ruleCheck($rule)) {
            return outputJsonError();
        }

        $data = $this->expressService->info($this->params);
        return outputJsonResult($data);
    }
}
